package dubbo.server4.impl.kafka;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
public class KafkaSender {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;
    public void sendMsg(String msg){
        kafkaTemplate.send("test_topic", msg);
        logger.info("KafkaSender.send 消息已发送！msg={}",msg);
    }
}
